import random

guess_number = random.randint(0, 9)
count_guesses = 0

while True:
    try:
        guess = int(input("请输入你猜的数字："))
        count_guesses += 1

        if guess == guess_number:
            print(f"预测{count_guesses}次，你猜中了！")
            break
        elif guess > guess_number:
            print("遗憾，太大了")
        else:
            print("遗憾，太小了")
    except ValueError:
        print("输入内容必须为整数！请重新输入。")